<template>
  <h1>菜单组件</h1>
</template @select="handleSelect">
<el-menu>
  <el-menu-item index="1">首页</el-menu-item>
  <el-menu-item index="2">免费课</el-menu-item>
  <el-menu-item index="3">直播课</el-menu-item>
  <el-menu-item index="4">精品课</el-menu-item>
  <el-menu-item index="5">线上班</el-menu-item>
  <el-sub-menu index="6">
    <template #title>线下班</template>
    <el-menu-item index="6-1">JSDTN2409</el-menu-item>
    <el-menu-item index="6-2">JSDTN2410</el-menu-item>
    <el-menu-item index="6-3">JSDTN2411</el-menu-item>
  </el-sub-menu>
</el-menu>
<script setup>
//index指的是用户选择的是哪个菜单项，对应菜单项index的值，比如3表示选择了"直播课"
//indexPath指的是如何到达当前菜单项，比如"6-1"表示从"线下班"菜单项到达"JSDTN2409"菜单项
const handleSelect = (index,indexPath) =>{
  console.log(index,indexPath);
}

</script>

<style scoped>

</style>